<?php //require_once '../view/header.php'; 
      require_once '../../../Components/Config.inc.php'; 
      global $config;
      //die('esto es-> '.$config['emailDeveloper']);
?>
<?php 
    $idLicensePlate=base64_decode($_GET['idLicensePlate']);
    global $config;                  
    $columns='*';
    $table=$config['tableVehicle'];  
    //die('esto es-> '.$table);
    $condition="'".$idLicensePlate."'";
    $query="select $columns from $table where id_placa= $condition";
    $objDb=new Class_Db();
    $objDb->selectManager()->connect();
    //die($columns.''.$table.''.$condition);
    //$consult=$objDb->selectManager()->selectAdd($columns, $table, $condition);    
    $consult=$objDb->selectManager()->select($query);
    //die('es'.$consult[0][1]);
?>
<form action="/app_registro_vehiculos/principal.php?action=modify&controller=Vehicle" method="post">
    <center>
        <fieldset style="width: 250px">                
            <table>
                <tr>
                    <td>PLACA</td>
                    <td><input type="text" name="placa" value="<?php echo $consult[0][0]; ?>" readonly required placeholder="PLACA" autofocus maxlength="7"/></td>
                </tr>
                <tr>
                    <td>CATEGORIA</td>
                    <td>
                        <?php 
                                  $objDb->selectManager()->connect();
                                  $query2="select id_categoria,nombre from categoria";
                                  $consult2=$objDb->selectManager()->select($query2);
                                  //die('ddd'.$consult[0][1]);
                        ?>
                        <select  name="categoria">
                            <?php
                                  for($i=0;$i<count($consult2);$i++){      
                                      if($consult[0][1]==$consult2[$i][0]){                                               
                            ?>
                            <option value="<?php echo $consult2[$i][0]; ?>" selected><?php echo $consult2[$i][1]; ?></option>
                            <?          }else{
                                ?>
                            <option value="<?php echo $consult2[$i][0]; ?>"><?php echo $consult2[$i][1]; ?></option>
                                    <?php
                                        }
                                  }?>
                        </select>
                    </td>
                    
                </tr>
                <tr>
                    <td>SERIE</td>
                    <td><input type="text" name="serie" value="<?php echo $consult[0][2]; ?>" required placeholder="SERIE" maxlength="17" /></td>
                </tr>
                <tr>
                    <td>MARCA</td>
                    <td><input type="text" name="marca" value="<?php echo $consult[0][3]; ?>" required placeholder="MARCA" maxlength="30"/></td>
                </tr>
                <tr>
                    <td>MODELO</td>
                    <td><input type="text" name="modelo" value="<?php echo $consult[0][4]; ?>" required placeholder="MODELO" maxlength="30"/></td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Guardar"  />
                    </td>
                </tr>
            </table>                
        </fieldset>             
    </center>
 </form>
<center>
    <!--<div style="text-align: center">
        <?php include_once '../view/botonInicio.php'; ?>
    </div>-->
</center>